<!--
 * @Author: wei_w
 * @Date: 2025-02-11 17:46:39
 * @LastEditors: wei_w
 * @LastEditTime: 2025-02-11 17:56:36
 * @Description: 
-->
<template>
  <div id="app">
    <!-- <img alt="Vue logo" src="./assets/logo.png"> -->
    <el-dropdown  @command="handleThemeCommand">
      <span class="el-dropdown-link">
        <el-tooltip content="主题切换" placement="left">
          <div class="color-block" :style="{ backgroundColor: currentTheme }" ></div>
        </el-tooltip>
        <!-- <el-icon class="el-icon--right"><arrow-down /></el-icon> -->
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item v-for="(item,index) in themes" :key="index" :command="item.color">
            <!-- <el-color-picker v-model="item.color" disabled/>  -->
            <div class="color-block" :style="{ backgroundColor: item.color }" ></div>
            {{ item.name }}
          </el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
    <HelloWorld msg="Welcome to Your Vue.js App"/>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {
    HelloWorld
  },
  data(){
    return {
      currentTheme: '#409EFF',
      themes: [
        { color: '#409EFF', name: '晴空蓝'},
        { color: '#2979FF', name: '深海蓝'},
        { color: '#43A047', name: '翡翠绿'},
        { color: '#FFB74D', name: '金秋黄'},
        { color: '#FF9800', name: '活力橙'},
        { color: '#9C27B0', name: '神秘紫'},
        { color: '#795548', name: '巧克力棕'},
        { color: '#333333', name: '石墨黑'}
      ],
    }
  },
  methods: {
    handleThemeCommand(command) {
      console.log('command: ', command);
      this.currentTheme = command;
    },
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  /* margin-top: 60px; */
}
.el-dropdown-link {
  margin-right: 12px;
  cursor: pointer;
}
/* 定义色块样式 */
.color-block {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin: 0 4px;
  border: 1px solid #ccc; /* 添加边框以便区分色块 */
  border-radius: 4px; /* 圆角效果 */
}

</style>
